package top.lixunda.ecommerce.server.user.api.entity.dto;

import lombok.Data;
import lombok.EqualsAndHashCode;
import top.lixunda.ecommerce.server.user.api.entity.db.BindingTypeDO;
import top.lixunda.common.validate.annotation.XumBetween;
import top.lixunda.common.validate.annotation.XumIncludes;
import top.lixunda.common.validate.annotation.XumNotNull;
import top.lixunda.common.validate.annotation.XumRegex;

/**
 * @author Xumda
 * @version time:2019/12/15 11:53
 * <p>
 * 根据验证码修改密码，手机验证码和邮箱验证码
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class ChangePassCodeDTO {

    /**
     * 邮箱登陆 4
     */
    public static final int TYPE_EMAIL = BindingTypeDO.BINDING_TYPE_EMAIL;

    /**
     * 手机号码登陆 5
     */
    public static final int TYPE_PHONE = BindingTypeDO.BINDING_TYPE_PHONE;

    /**
     * 验证码类型，见常量
     */
    @XumNotNull
    @XumIncludes(numbers = {TYPE_EMAIL, TYPE_PHONE})
    private Integer type;

    /**
     * 用户名，可以是邮箱，手机，身份证号
     */
    @XumNotNull
    @XumBetween(min = 6, max = 32)
    private String account;

    /**
     * 新密码
     */
    @XumNotNull
    @XumBetween(min = 6, max = 32)
    private String newPass;

    /**
     * 验证码
     */
    @XumNotNull
    @XumRegex("^[0-9a-zA-Z]{4,6}$")
    private String code;

}
